<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"></script>
<script type="text/javascript">
    $(document).ready(function(){ 

        $(function() {
            $("#contentLeft ul").sortable({ opacity: 0.6, cursor: 'move', update: function() {
                    var order = $(this).sortable("serialize") + '&update=update'; 
                    $.post("<?php echo $this->base ?>/admin/Profilefields/sorted", order, function(theResponse){
                      //  $("#contentRight").html(theResponse);
                    }); 															 
                }								  
            });
        });

    });	
</script>
<style>
    .listing_profile_field{
         clear: both;
    content: ".";
    display: block;
    height: 0;
 
    }
    .listing_profile_field li{
     display: inline;
    float: left;
    position: relative;
    cursor: move;
    }
    .title{
        width: 120px;
        float:left;
        margin-left: 50px;
        font-size: 14px;
       
    }
    .question{
        width: 300px;
        float:left;
        font-size: 14px;
        margin-left: 10px;
    }
    .title1{
        width: 120px;
        float:left;
        margin-left: 43px;
        
    }
    .question1{
        width: 300px;
        float:left;
        
        margin-left: 10px;
    }
</style>
<table width="1024px">
    <tr ><td><div  style="float:right">
                <?php
                echo $this->Html->link(
                        $this->Html->image('../img/add_more.png', array('alt' => 'Add more')), array('action' => 'add'), array('escape' => false, 'class' => 'noprint')
                );
                ?></div></div></td></tr>
    <tr><td>&nbsp;</td></tr>
    <tr><td style=" background: #B0CAEA; height: 30px;">
                    <div class="title"><?php // echo $this->Paginator->sort("Order", 'order'); ?></div>    
                    <div class="title"><?php echo $this->Paginator->sort("Title", 'title'); ?></div>
                    <div class="title"><?php echo $this->Paginator->sort("Type", 'type'); ?></div>
                    <div class="question"><?php echo $this->Paginator->sort("Question", 'question'); ?></div>
                    <div class="title">Edit</div>
                    <div class="title">Delete</div>
                    
        </td>
    <tr>
        
        <td>
            <div id="contentLeft">
            <ul id="ui-sortable"  class="listing_profile_field">
      
 
                        
                   <?php $i=1; foreach ($fields as $data): ?>
                <li  id="recordsArray_<?php echo $data['Profilefield']['id']; ?>"><div class="title1"><?php //echo $data['Profilefield']['order']; ?></div>
                            <div class="title1"><?php echo $data['Profilefield']['title']; ?>&nbsp;</div>
                            <div class="title1"><?php echo $data['Profilefield']['type']; ?>&nbsp;</div>
                            <div class="question1"><?php echo $data['Profilefield']['question']; ?>&nbsp;</div>
                           <div class="title1"> <?php echo $this->Html->link($this->Html->image('user_edit.png', array('alt' => 'Edit', 'title' => 'edit', 'border' => '0')), array('action' => 'admin_edit', $data['Profilefield']['id']), array('escape' => false)); ?></div>
                           <div class="title1"> <?php echo $this->Html->link($this->Html->image('trash.png', array('alt' => 'Delete', 'title' => 'Delete', 'border' => '0')), array('action' => 'admin_delete', $data['Profilefield']['id']), array('escape' => false, 'onclick' => "return confirm('Are you sure you want to delete?')")); ?></div>
                        </li>
                    <?php $i++; endforeach; ?>
                                
           
            </ul>
            </div>
        </td>
              <tr><td><?php
                        echo $this->Paginator->numbers();
                        ?></td></tr>
    </tr>
</table>
